/**
 * @param {string} time
 * @return {number}
 */
var countTime = function (time) {
  if (!time.includes('?')) return 0
  let pre, suffix
  if (time[0] == '?') {
    if (time[1] == '?') {
      pre = 24
    } else {
      if (time[1] <= 4) {
        pre = 3
      } else {
        pre = 2
      }
    }

  } else {

    if (time[1] == '?') {
      if (time[0] != 2) {
        pre = 10
      } else pre = 4
    }
    else pre = 1
  }

  if (time[3] == '?') {
    if (time[4] == '?') {
      suffix = 60
    } else {
      suffix = 6
    }

  } else {
    if (time[1] == '?') suffix = 10
    else suffix = 1
  }

  return pre * suffix

};